<template>
  <div>
    <el-card>
      <div slot="header" class="clearfix">
        <span>AML出货数据详情</span>
      </div>
      <el-form
        ref="orderForm"
        :model="orderForm"
        :rules="formRule"
        label-position="right"
        label-width="120px"
        style="width:100%;flex-wrap:wrap"
        class="flex"
      >
        <el-form-item label="制造商料号" prop="recordNum" style="width:30%">
          <el-input v-model="orderForm.productManuNum" readonly="true" placeholder="" :disabled="isDisabled"></el-input>
        </el-form-item>
        <el-form-item label="制造商" prop="from" style="width:30%">
          <el-input v-model="orderForm.meunName" readonly="true" placeholder="" :disabled="isDisabled"></el-input>
        </el-form-item>
        <el-form-item label="AKS料号" prop="createTime" style="width:30%">
          <el-input v-model="orderForm.aksNum" readonly="true" placeholder="" :disabled="isDisabled"></el-input>
        </el-form-item>

        <el-form-item label="价格" prop="pm" style="width:30%">
          <el-input v-model="orderForm.price" readonly="true" placeholder="" :disabled="isDisabled"></el-input>
        </el-form-item>
        <el-form-item label="美金价格" prop="pm" style="width:30%">
          <el-input v-model="orderForm.dollar" readonly="true" placeholder="" :disabled="isDisabled"></el-input>
        </el-form-item>
        <el-form-item label="税金" prop="mobile" style="width:30%">
          <el-input v-model="orderForm.tax" readonly="true" placeholder="" :disabled="isDisabled"></el-input>
        </el-form-item>
        <el-form-item label="购买数量" prop="company" style="width:30%">
          <el-input v-model="orderForm.count" readonly="true" placeholder="" :disabled="isDisabled"></el-input>
        </el-form-item>
        <el-form-item label="交货时间" prop="status" style="width:30%">
          <!--<el-input v-model="orderForm.dealTime" readonly="true" placeholder="" :disabled="isDisabled">-->
          <!--</el-input>-->
            <template slot-scope="scope">
              <label>{{scope.row.dealTime  | formatDate}}</label>
            </template>

        </el-form-item>
        <el-form-item label="备注" prop="remark" style="width:30%">
          <el-input v-model="orderForm.memo" readonly="true" placeholder="" :disabled="isDisabled"></el-input>
        </el-form-item>
        <el-form-item label="审核状态" prop="companyAddress" style="width:30%">
          <el-input v-model="orderForm.status" readonly="true" placeholder="" :disabled="isDisabled"></el-input>
        </el-form-item>
        <el-form-item label="是否入库" prop="company" style="width:30%">
          <el-input v-model="orderForm.inStore" readonly="true" placeholder="" :disabled="isDisabled"></el-input>
        </el-form-item>
        <el-form-item label="入库数量" prop="useProduct" style="width:30%">
          <el-input v-model="orderForm.inStoreNum" readonly="true" placeholder="" :disabled="isDisabled"></el-input>
        </el-form-item>

      </el-form>

      <!--<el-table :data="tableData" style="width: 100%" height="400" stripe>-->
        <!--<el-table-column prop="productNum" label="制造商料号" align="center"></el-table-column>-->
        <!--<el-table-column prop="count" label="申请数量" align="center"></el-table-column>-->
        <!--<el-table-column prop="manufacturer" label="供应商" align="center"></el-table-column>-->
        <!--<el-table-column prop="manufacturer" label="物流号" align="center"></el-table-column>-->
        <!--<el-table-column prop="status" label="样品状态" :formatter="formatStatus" align="center"></el-table-column>-->
        <!--<el-table-column prop="manufacturer" label="审批答复" align="center"></el-table-column>-->
        <!--<el-table-column label="操作" fixed="right" width="150"-->
                         <!--align="center">-->
          <!--<template slot-scope="scope" >-->
              <!--<el-button type="text"-->
                         <!--@click="downLoad(scope.row)">资料下载</el-button>-->
          <!--</template>-->
        <!--</el-table-column>-->
      <!--</el-table>-->
      <!--<el-pagination-->
        <!--style="text-align:center;margin-top:20px"-->
        <!--@size-change="handleSizeChange"-->
        <!--@current-change="handleCurrentChange"-->
        <!--:current-page="currentPage"-->
        <!--:page-sizes="[5]"-->
        <!--:page-size="pageSize"-->
        <!--layout="total, sizes, prev, pager, next, jumper"-->
        <!--:total="total"-->
      <!--&gt;</el-pagination>-->
    </el-card>
    <el-button class="back" @click="$router.go(-1)">返回列表</el-button>
  </div>
</template>

<script>
import {
  SAMPLE_RECORDLISTBYMAINID,applyr,currentUser,userDetail
} from '@/utils/api';
import { formatDate } from '@/utils/validate.js';
import { Message } from 'element-ui'
export default {
  data() {
    return {
      orderForm: {},
      formRule: {},
      tableData: [],
      isDisabled: false,
      currentPage: 1,
      pageSize: 5,
      total: 0
    };
  },
  mounted() {

    if (this.$route.query["data"]) {
        this.orderForm = this.$route.query["data"]

          console.log(this.orderForm)
            if(this.orderForm.status == 0){
                this.orderForm.status ='已提交审核，原厂审核中'
            }
            if(this.orderForm.status == 1){
                this.orderForm.status ='已审核'
            }
            if(this.orderForm.status == 2){
                this.orderForm.status ='已婉拒'
            }
            if(this.orderForm.status == 3){
                this.orderForm.status ='待发货'
            }
            if(this.orderForm.status == 4){
                this.orderForm.status ='待收货'
            }
            if(this.orderForm.status == 5){
                this.orderForm.status ='待评价 '
            }
      
        console.log(this.orderForm)
    }
  },


  methods: {
      getDetail(uid){

          userDetail({
              id:uid,
          }).then(res => {

             // this.orderForm.account=res.data.account
             //  this.orderForm.phone=res.data.phone
             //  this.orderForm.company_name=res.data.company_name
             //  this.orderForm.company_nature=res.data.company_nature
             //  this.orderForm.company_trade=res.data.company_trade
             //  this.orderForm.company_product=res.data.company_product
             //  this.orderForm.company_addres=res.data.company_addres
             //  this.orderForm.company_tel=res.data.company_tel
             //  this.orderForm.company_contact=res.data.company_contact
             //  this.orderForm.email=res.data.email
              this.orderForm=res.data
            console.log(this.orderForm)
          })
      },



    formatFrom (row, column) {
      var status = row[column.property]
      switch (status) {
        case 0: return 'AML'
        case 1: return '商城申请'
      }
    },
    //时间格式化  
    formatSecond(row, column) {
//    var second = row[column.property];  
//    if (!second) return ""; 
      return formatDate(new Date(row*1000),"yyyy-MM-dd hh:mm:ss");  
    },
    // 订单状态格式化
    formatStatus(row, column) {
      var status = row[column.property]
      switch(status) {
        case 0: return '审核中'
        case 1: return '已审核'
        case 2: return '已婉拒'
        case 3: return '待发货'
        case 4: return '待收货'
        case 5: return '待评价'
        default: return '未知'
      }
    },
    getOrderList(){
      SAMPLE_RECORDLISTBYMAINID({ 
	      recordmainId:this.orderForm.id,
	      pageNo: this.currentPage,
	      pageSize: this.pageSize
      }).then(res => {
	      this.tableData = res.data.dataList
	      this.total = res.data.count
      })
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
      this.pageSize=val
      this.getOrderList()
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
      this.currentPage=val
      this.getOrderList()
    }
  }
};
</script>

<style lang="scss" scoped>
  .back {
    background: rgb(7, 131, 241);
    color: #fff;
    width: 30%;
    margin: 25px 0;
  }
</style>